package com.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the comments database table.
 * 
 */
@Embeddable
public class CommentPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	private String email;

	private int bookid;

    public CommentPK() {
    }
	public String getEmail() {
		return this.email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public int getBookid() {
		return this.bookid;
	}
	public void setBookid(int bookid) {
		this.bookid = bookid;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CommentPK)) {
			return false;
		}
		CommentPK castOther = (CommentPK)other;
		return 
			this.email.equals(castOther.email)
			&& (this.bookid == castOther.bookid);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.email.hashCode();
		hash = hash * prime + this.bookid;
		
		return hash;
    }
}